package net.pulseproject.commons.misc.preferences;

import java.awt.Dimension;

import net.pulseproject.commons.util.StringConverterUtil;

class PreferencesDimensionField extends PreferencesConvertableField<Dimension> {
	
	private static final DimensionConverter CONVERTER = new DimensionConverter();
	
	public PreferencesDimensionField(final String key, final Dimension defaultValue) {
		super(key, defaultValue, CONVERTER);
	}
	

	private static class DimensionConverter implements Converter<Dimension> {
		
		@Override
		public String format(final Dimension instance) {
			return StringConverterUtil.formatDimensionRaw(instance);
		}

		@Override
		public Dimension parse(final String rawString) {
			return StringConverterUtil.parseRawDimension(rawString);
		}
	}
}
